<template>
	<div class="AdminConfirm">
		<Table border :columns="columns12" :data="apply">
			<template slot-scope="{ row }" slot="name">
				<strong>{{ row.name }}</strong>
			</template>
			<template slot-scope="{ row, index }" slot="action">
				<Button type="primary" size="small" style="margin-right: 5px" @click="show(index)">通过</Button>
				<Button type="error" size="small" @click="remove(index)">驳回</Button>
			</template>
		</Table>
	</div>
</template>
<script>
	export default {
		name: "AdminConfirm",
		data () {
			return {
				columns12: [
					{
						title: '店名',
						slot: 'name'
					},
					{
						title: '店铺类型',
						key: 'type'
					},
					{
						title: '地址',
						key: 'address'
					},
					{
						title: 'Action',
						slot: 'action',
						width: 150,
						align: 'center'
					}
				],
				apply: [{

				}],
			}
		},

		methods: {

			async show (index) {
				let kk=await this.$axios.post('root/RootSee/id_shop',this.apply[index]).then(r=>r.data)
				if(kk){
					this.$Message.success('已通过申请');
					this.apply.splice(index, 1);
				} else {
					this.$Message.error('通过失败，请稍后再试');
				}
			},
			async remove (index) {
				let del = await this.$axios.post('root/RootSee/del_shop',this.apply[index]).then(r=>r.data)
				if (del){
					this.apply.splice(index, 1);
					this.$Message.success('驳回成功');
				}else {
					this.$Message.error('驳回失败，请稍后再试');
				}
			}
		},
		async mounted() {
			let apply1 = await this.$axios.post('/root/RootSee/apply_state').then(r=>r.data)
			this.apply=apply1.weitong
		}
	}
</script>

<style lang="less">
	.AdminConfirm{
		width: 1000px;
		margin: 20px auto;
	}
</style>